<!doctype html>
<html>
<head>
    <meta charset="utf-8">
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <link rel="__ROOT__/Public/Admin/css/shortcut icon" href="favicon.ico">
    <link href="__ROOT__/Public/Admin/css/bootstrap.min.css?v=3.3.6" rel="stylesheet">
    <link href="__ROOT__/Public/Admin/css/animate.css" rel="stylesheet">
    <link href="__ROOT__/Public/Admin/css/style.css?v=4.1.0" rel="stylesheet">
    <link href="__ROOT__/Public/Admin/js/plugins/cityPicker/city-picker.css" rel="stylesheet">
    <link href="__ROOT__/Public/Admin/js/plugins/sweetalert/sweetalert.css" rel="stylesheet">
    <link href="__ROOT__/Public/Admin/css/edit.css" rel="stylesheet"/>

<style>

</style>
<body class="gray-bg">
    <div class="wrapper wrapper-content animated fadeInRight">
        <div class="row">
            <form class="form-horizontal m-t js-ajax-forms" id="signupForm" action="<if condition="$editdata">{:U('Admin/ContractTemplate/update')}<else />{:U('Admin/ContractTemplate/add')}</if>" method="post" enctype="multipart/form-data">
           	<input type="hidden" name="ID" value="{$editdata['ID']}">
            <input type="hidden" name="ContractID" value="{$ContractID}">
            <div class="col-sm-8  col-md-offset-2">
                <div class="ibox float-e-margins">
                    <div class="ibox-content">
                            <div class="form-group">
                                <label class="col-sm-3 control-label">标题 <span style="color: red">*</span> </label>
                                <div class="col-sm-8">
                                    <input id="Title" name="Title" class="form-control" type="text" aria-required="true" aria-invalid="true" class="error" value="{$editdata.Title}">
                                </div>
                            </div>
                            
                            <div class="form-group">
                                <label class="col-sm-3 control-label">上传人</label>
                                <div class="col-sm-8">
                                    <input id="Author" name="Author" class="form-control" type="text" aria-required="true" aria-invalid="false" class="error" value="{$editdata.Author}">
                                </div>
                            </div>
                            
                            <div class="form-group">
                                <label class="col-sm-3 control-label">合同模板 <span style="color: red">*</span></label>
                                  <div class="col-sm-8">
                                   <!--  <input id="Content" name="Content" class="form-control" type="textarea" aria-required="true" aria-invalid="true" class="error" vContentalue="{$editdata.Content}"> -->
                                 <!--    <script id="Content"  name='Content' type="text/plain" ></script> -->

                                 <textarea id="Content" name="Content" style="width: 100%">{$editdata.Content}</textarea>
                                </div>
                            </div>
                            
	                        <div class="form-group">
                                <label class="col-sm-3 control-label">分类 <span style="color: red">*</span></label>
                                <div class="col-sm-8">
                                    <select class="form-control" id="CatID" name="CatID" aria-required="true" aria-invalid="true" class="error">
                                        <option value="">请选择模板分类</option>
                                        <foreach name="data.selectlis" item="vo">
                                        	<option <if condition="$vo.ID eq $editdata['CatID']"> selected </if> value="{$vo.ID}">{$vo.Name}</option>
										</foreach>
                                    </select>
                                </div>
                            </div>
	                        

                            <div class="form-group">
                                <div class="col-sm-8 col-sm-offset-3">
                                    <button class="btn btn-primary keep" type="submit">保存</button>
                                    <a class="btn btn-white" href="javascript:void(0);" onclick="self.location=document.referrer;">返回</a>
                                </div>
                            </div>
                        
                    </div>
                </div>
            </div>
           
            </form>
        </div>
    </div>
    

	

	<script src="__ROOT__/Public/Admin/js/jquery-1.7.2.min.js"></script>

	<script src="__ROOT__/Public/Admin/js/plugins/validate/jquery.validate.min.js"></script>
	<script src="__ROOT__/Public/Admin/js/ajaxForm.js"></script>
	<script src="__ROOT__/Public/Admin/js/plugins/sweetalert/sweetalert.min.js"></script>
	
	<link href="__ROOT__/Public/Admin/css/selector/selectorstyle.css" rel="stylesheet"/>
	<script src="__ROOT__/Public/Admin/js/plugins/selector/selector.js"></script>
 	<script src="__ROOT__/Public/Admin/js/plugins/selector/jquery.ztree.all.js"></script>
 	 
    <!-- 引入富文本编辑器 -->
    <script  src="__ROOT__/Public/Admin/js/plugins/ueditor/custom.config.js"></script>
    <script  src="__ROOT__/Public/Admin/js/plugins/ueditor/ueditor.all.min.js"> </script>
    <!--语言包-->
    <script src="__ROOT__/Public/Admin/js/plugins/ueditor/lang/zh-cn/zh-cn.js"></script>

    <!-- tpsave -->
    <script src="__ROOT__/Public/Admin/js/Contract/tpsave.js"></script>
<script type="text/javascript">

 $(document).ready(function () {
    var icon = "<i class='fa fa-times-circle'></i>";
                var form = $('form.js-ajax-forms');
                var formloading = false;
                var validator = $("#signupForm").submit(function() {
                    UE.getEditor('Content').sync();
                }).validate({
                     submitHandler : function(forms) {
                    if (formloading)
                    return;
                    $(forms).ajaxSubmit({
                        url : form.attr('action'), //按钮上是否自定义提交地址(多按钮情况)
                        dataType : 'json',
                        beforeSubmit : function(arr, $form, options) {
                            formloading = true;
                        },
                        success : function(data, statusText, xhr, $form) {
                            formloading = false;
                            if (data.status) {
                                //添加成功
                                swal({
                                    title: "继续操作？",
                                    text: "操作成功！",
                                    type: "success",
                                    showCancelButton: true,
                                    confirmButtonColor: "#DD6B55",
                                    confirmButtonText: "确认",
                                    cancelButtonText: "返回",
                                    closeOnConfirm: false,
                                    closeOnCancel: false
                                },
                                function (isConfirm) {
                                    if (isConfirm) {
                                        document.location.reload();
                                    } else {
                                        document.location.href = "/index.php?m=Admin&c=ContractTemplate&a=index";
                                        return true;
                                    }
                                }); 
                            } else {
                                swal("操作失败", data.info, "error");
                            }
                        }
                    });
                },
                        });
 })

</script>


</body>

</html>
